﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Kokomo.PeInspector.VisualStudioAdapter
{
	/// <summary>
	/// Represents a reference to an assembly external to a <see cref="CSharpProject"/>.
	/// </summary>
	public class ReferenceItem : ProjectItem
	{
		/// <summary>
		/// Gets or sets the value of the <c>SpecificVersion</c> attribute.
		/// </summary>
		public bool SpecificVersion { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>HintPath</c> attribute.
		/// </summary>
		public string HintPath { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>Private</c> attribute.
		/// </summary>
		public bool Private { get; set; }

		public override void WriteXml(System.Xml.XmlWriter writer)
		{
			writer.WriteStartElement("Reference");

			base.WriteXmlAttributes(writer);

			if (this.SpecificVersion) writer.WriteElementString("SpecificVersion", "True");
			if (this.HintPath != null) writer.WriteElementString("HintPath", this.HintPath);
			if (this.Private) writer.WriteElementString("Private", "True");

			writer.WriteEndElement();
		}
	}
}
